package exp2;

/**
 * Created by Veronica on 2017/4/20.
 */
public class PrintArrays02 {
    public static void main(String[] args) {
        //添加代码删除数组中的5
        int arr[] = {1,2,3,4,5,6,7,8};
        for (int i = 0;i <arr.length;i++){
            if (5==arr[i]){
                for (int j=i+1;j <arr.length;j++){
                    arr[i]=arr[j];
                }
                arr[arr.length-1]=0;
            }
            System.out.print(arr[i] + ",");
        }
    }
}
